class AccessLogFilters {

    def accessLogService;
    def authenticateLogService;

    def filters = {

        all(controller: '*', action: '*') {
            before = {

            }
            after = {
                //所有的访问日志
                accessLogService.consoleLogAction(request)
                return true
            }
            afterView = {

            }
        }

        justAuthLog(controller: 'auth', action: '*') {
            before = {
                if ('logout' == actionName) {
                    //记录用户注销记录
                    authenticateLogService.userOutLog(request, session);
                }
                return true;
            }
            after = { Map model ->
                return true;
            }
            afterView = { Exception e ->
                if ('authenticate' == actionName) {
                    //同步用户登录信息
                    authenticateLogService.userSignLog(request, session);
                }
                return true;
            }
        }
    }
}
